#ifndef __LCD_H
#define __LCD_H		
#include "common.h"	 
#include "stdlib.h"

//Suitable for ATK - 1.3' TFTLCD module	 
//SPI clock is divided by SPI_BaudRatePrescaler_2
 

extern u16	POINT_COLOR;	
extern u16	BACK_COLOR;		


#define LCD_Width 	240
#define LCD_Height 	240

/*
    	LCD_PWR:	PG6
    	LCD_RST:	PG8
    	LCD_WR:		PC1
    	LCD_CS:		PB12
	    LCD_SCK:    PB3
	    LCD_SDA     PB5
*/
#define	LCD_PWR		PGout(6)
#define	LCD_RST		PGout(8)
#define	LCD_WR		PCout(1)
#define	LCD_CS		PBout(12)

//POINT COLOR
#define WHITE         	 0xFFFF
#define BLACK         	 0x0000	  
#define BLUE         	 0x001F  
#define BRED             0XF81F
#define GRED 			 0XFFE0
#define GBLUE			 0X07FF 
#define RED           	 0xF800
#define MAGENTA       	 0xF81F 
#define GREEN         	 0x07E0
#define CYAN          	 0x7FFF 
#define YELLOW        	 0xFFE0
#define BROWN 			 0XBC40 
#define BRRED 			 0XFC07 
#define GRAY  			 0X8430 
//GUI COLOR

#define DARKBLUE      	 0X01CF	
#define LIGHTBLUE      	 0X7D7C	 
#define GRAYBLUE       	 0X5458 
//PANEL COLOR 
 
#define LIGHTGREEN     	 0X841F 
#define LGRAY 			 0XC618 

#define LGRAYBLUE        0XA651 
#define LBBLUE           0X2B12 

void LCD_Init(void);																	//initialization
void LCD_DisplayOn(void);																//
void LCD_DisplayOff(void);																//
void LCD_Write_HalfWord(const u16 da);													//
void LCD_Address_Set(u16 x1, u16 y1, u16 x2, u16 y2);									//Set the data display area
void LCD_Clear(u16 color);																//
void LCD_Fill(u16 x_start, u16 y_start, u16 x_end, u16 y_end, u16 color);				//
void LCD_Draw_Point(u16 x, u16 y);														//
void LCD_Draw_ColorPoint(u16 x, u16 y,u16 color);										//
void LCD_DrawLine(u16 x1, u16 y1, u16 x2, u16 y2);										//
void LCD_DrawRectangle(u16 x1, u16 y1, u16 x2, u16 y2);									//
void LCD_Draw_Circle(u16 x0, u16 y0, u8 r);												//
void LCD_DisplayChar(u16 x, u16 y, u8 word, u8 size);                                   //
void LCD_ShowNum(u16 x,u16 y,u32 num,u8 len,u8 size);									//
void LCD_ShowxNum(u16 x,u16 y,u32 num,u8 len,u8 size,u8 mode);							//
void LCD_DisplayString(u16 x, u16 y, u8 size, u8 *p);                                   //
void LCD_Show_Image(u16 x, u16 y, u16 width, u16 height, const u8 *p);					//



#endif
	 
	 



